package com.shenmazong.controller;


import com.shenmazong.service.TbCounterService;
import com.shenmazong.utils.ResultResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.annotation.Resources;

/**
 * <p>
 * 文章数据表  ——>  John 前端控制器
 * </p>
 *
 * @author 还怕大雨吗
 * @since 2021-09-18
 */
@RestController
@RequestMapping("/tbCounter")
@CrossOrigin
public class TbCounterController {

    @Resource
    private TbCounterService tbCounterService;


    /***
     * @description 查询自己的所有点赞与浏览
     * @params [userID]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 14:40
     */
    @PostMapping("/selectCounter")
    public ResultResponse selectCounter(Long userID){
        return tbCounterService.selectCounter(userID);
    }


    /***
     * @description 点赞
     * @params []
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/26 10:10
     */
    @PostMapping("/insertCounterUser")
    public ResultResponse insertCounterUser(String articId, String userId){
        return tbCounterService.insertCounterUser(articId,userId);
    }

    /***
     * @description 同步点赞
     * @params []
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/26 10:51
     */
    @PostMapping("/selectCounterUser")
    public ResultResponse selectCounterUser(String articId){
        return tbCounterService.selectCounterUser(articId);
    }



}

